let OrderModule=require('./../module/orderxmModule.js');
let json={
    'getorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.getorder(req.body.JD_uid, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误'});
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                 }else{
                    res.send({error:1,Master_Order:'数据不存在'});
                }
            }
        });
    },
    'dzforder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.dzforder(req.body.JD_uid,req.body.JD_puon, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误'});
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,Master_Order:'数据不存在'});
                }
            }
        });
    },
    'jxzorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.jxzorder(req.body.JD_uid,req.body.JD_puon, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误'});
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,Master_Order:'数据不存在'});
                }
            }
        });
    },
    'ywcorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.ywcorder(req.body.JD_uid,req.body.JD_puon1,req.body.JD_puon2, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误'});
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,Master_Order:'数据不存在'});
                }
            }
        });
    },
    'yqxzforder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.yqxzforder(req.body.JD_uid,req.body.JD_puon,req.body.JD_zfdatetimes,req.body.JD_co,function (err, data) {
            console.log(req.body.JD_uid,req.body.JD_puon,req.body.JD_zfdatetimes,req.body.JD_co);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误'});
            }else{
                res.send({error:0,Master_Order:'订单取消成功'});
            }
        });
    },
    'yqxjdorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.yqxjdorder(req.body.JD_uid,req.body.JD_puon,req.body.JD_jddatetimes,req.body.JD_co,function (err, data) {
            console.log(req.body.JD_uid,req.body.JD_puon,req.body.JD_jddatetimes,req.body.JD_co);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误'});
            }else{
                res.send({error:0,Master_Order:'订单取消成功'});
            }
        });
    },
    'pjforder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.pjforder(req.body.JD_uid,req.body.JD_puon,req.body.JD_pldatetimes,req.body.JD_co,function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'修改状态失败'});
            }else{
                OrderModule.xiao(req.body.JD_pldatetimes,req.body.JD_co,req.body.EV_sec,req.body.EV_sorce,function (err, data) {

                    // res.send({error:0,Master_Order:'评价成功'});
                    if(err){
                        console.log('增加评论失败:'+err);
                        res.send({error:1,Master_Order:'数据库错误'});
                    }else{
                        res.send({error:0,Master_Order:'增加评价和修改状态成功'});
                    }

                })
            }
        });
    },
    'xgpjorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.xgpjorder(req.body.EV_sorce,req.body.EV_sec,req.body.EV_datetimes,req.body.JD_co,function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'修改评价失败'});
            }else{
                res.send({error:0,Master_Order:'修改评价成功'});
            }
        });
    },
    // 查看评价
    'splorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.splorder(req.body.JD_co,function (err, data) {
            console.log(req.body.JD_co);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误'});
            }else{
                //console.log(data);
                if(data.length){
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,Master_Order:'获取失败'});
                }
            }
        });
    },
    // 结束订单
    'wcorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.wcorder(req.body.JD_uid,req.body.JD_puon,req.body.JD_wcdatetimes,req.body.JD_co,function (err, data) {
            console.log(req.body.JD_uid,req.body.JD_puon,req.body.JD_wcdatetimes,req.body.JD_co);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,Master_Order:'数据库错误,请重新点击完成订单结束'});
            }else{
                res.send({error:0,data:'提交完成订单成功'});
            }
        });
    },
    // 超时支付还没成功
    'cszforder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.cszforder(req.body.JD_uid,req.body.JD_puon,req.body.JD_zfdatetimes,req.body.JD_co,function (err, data) {
            console.log(req.body.JD_uid,req.body.JD_puon,req.body.JD_zfdatetimes,req.body.JD_co);
            if(err){
                console.log('数据库错误:'+err);
            }else{
                res.send({error:0,Master_Order:'修改成功'});
            }
        });
    },
 // -------------------陪玩订单------------------------
 //    待接单
    'getplayorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.getplayorder(req.body.JD_puid, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,play_Order:"'数据库错误:'+err"})
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,play_Order:'数据不存在'});
                }
            }
        });
    },
    // 进行中
    'jxzplayorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.jxzplayorder(req.body.JD_puid,req.body.JD_puon, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,play_Order:"'数据库错误:'+err"});
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,play_Order:'数据不存在'});
                }
            }
        });
    },
    // 已完成
    'ywcplayorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.ywcplayorder(req.body.JD_puid,req.body.JD_puon1,req.body.JD_puon2, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,play_Order:"'数据库错误:'+err"});
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,play_Order:'数据不存在'});
                    //res.send({error:1,Master_Order:'数据不存在'});
                }
            }
        });
    },
    // 查看评论
    'splplayorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.splplayorder(req.body.JD_co,function (err, data) {
            console.log(req.body.JD_co);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,play_Order:"'数据库错误:'+err"});
            }else{
                //console.log(data);
                res.send({error:0,data:data});
            }
        });
    },
    // 接单
    'okplayorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.okplayorder(req.body.JD_co,req.body.JD_puon,req.body.JD_jddatetimes,req.body.JD_jxdatetimes,req.body.JD_puid,function (err, data) {
            console.log(req.body.JD_co,req.body.JD_puon,req.body.JD_jddatetimes,req.body.JD_jxdatetimes,req.body.JD_puid);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,play_Order:"'数据库错误:'+err"});
            }else{
                //console.log(data);
                res.send({error:0,data:'接单成功'});
            }
        });
    },
    // 拒绝订单
    'jujueplayorder':function (req,res) {
        // console.log(req.cookies);
        OrderModule.jujueplayorder(req.body.JD_co,req.body.JD_puon,req.body.JD_jddatetimes,req.body.JD_puid,function (err, data) {
            console.log(req.body.JD_co,req.body.JD_puon,req.body.JD_jddatetimes,req.body.JD_puid);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,play_Order:"'数据库错误:'+err"});
            }else{
                //console.log(data);
                res.send({error:0,data:'已拒绝'});
            }
        });
    },
    //查询搜索
    'queryoplay':function (req,res) {
        // console.log(req.cookies);
        OrderModule.queryoplay(req.body.JD_puid,req.body.U_falsename,function (err, data) {
            console.log(req.body.JD_puid,req.body.U_falsename);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,play_Order:"'数据库错误:'+err"});
            }else{
                //console.log(data);
                if(data.length){
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,play_Order:'数据不存在'});
                    //res.send({error:1,Master_Order:'数据不存在'});
                }

            }
        });
    },
// -----------------------------关注-----------------------------
    // 页面加载
    'getfollow':function (req,res) {
        // console.log(req.cookies);
        OrderModule.getfollow(req.body.FO_uid, function (err, data) {
            if(err){
                console.log('数据库错误:'+err);
            }else{
                if(data.length){
                    console.log(data);
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,Master_Order:'数据不存在'});
                }
            }
        });
    },
    // 确认单个取消
      // 查询关注的人id
    'dgqxfollow':function (req,res) {
        // console.log(req.cookies);
        OrderModule.dgqxfollow(req.body.U_photo,function (err, data) {
            console.log(req.body.U_photo);
            if(err){
                console.log('数据库错误:'+err);
            }else{
                if(data.length){
                    res.send({error:0,data:data});
                }else{
                    res.send({error:1,data:'没有此用户'});
                }
            }
        });
    },
    'dgqxfollow2':function (req,res) {
        // console.log(req.cookies);
        OrderModule.dgqxfollow2(req.body.FO_uid,req.body.FO_puid,function (err, data) {
            console.log(req.body.FO_uid,req.body.FO_puid,);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,data:'"数据库错误:"+err'});
            }else{
                res.send({error:0,data:'取消关注成功'});
            }
        });
    },
    // 确认全部取消
    'qbqxfollow':function (req,res) {
        // console.log(req.cookies);
        OrderModule.qbqxfollow(req.body.FO_uid,function (err, data) {
            console.log(req.body.FO_uid);
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,follow:'取消失败'});
            }else{
                res.send({error:0,data:'取消成功'});
                // if(data.length){
                //     res.send({error:0,data:data});
                // }else{
                //     res.send({error:1,data:'没有此用户'});
                // }
            }
        });
    },

// ----------------------------交易管理----------------------------------
    // 全选
    'getbusiness':function (req,res) {
        // console.log(req.cookies);
        OrderModule.getbusiness(req.body.JD_uid,function (err, data) {
            console.log(req.body.JD_uid);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    // 收入塞选
    'sybusiness':function (req,res) {
        // console.log(req.cookies);
        OrderModule.sybusiness(req.body.JD_uid,function (err, data) {
            console.log(req.body.JD_uid);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    // 支出筛选
    'zcbusiness':function (req,res) {
        // console.log(req.cookies);
        OrderModule.zcbusiness(req.body.JD_uid,function (err, data) {
            console.log(req.body.JD_uid);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }

            }
        });
    },
    // 时间筛选
    'alldatebusiness':function (req,res) {
        // console.log(req.cookies);
        OrderModule.alldatebusiness(req.body.JD_uid,req.body.begingtime, req.body.endtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.begingtime, req.body.endtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    'srdatebusiness':function (req,res) {
        // console.log(req.cookies);
        OrderModule.srdatebusiness(req.body.JD_uid,req.body.begingtime, req.body.endtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.begingtime, req.body.endtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    'zcdatebusiness':function (req,res) {
        // console.log(req.cookies);
        OrderModule.zcdatebusiness(req.body.JD_uid,req.body.begingtime, req.body.endtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.begingtime, req.body.endtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }

            }
        });
    },

    'alldatebusiness1':function (req,res) {
        // console.log(req.cookies);
        OrderModule.alldatebusiness1(req.body.JD_uid,req.body.begingtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.begingtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    'srdatebusiness1':function (req,res) {
        // console.log(req.cookies);
        OrderModule.srdatebusiness1(req.body.JD_uid,req.body.begingtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.begingtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    'zcdatebusiness1':function (req,res) {
        // console.log(req.cookies);
        OrderModule.zcdatebusiness1(req.body.JD_uid,req.body.begingtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.begingtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }

            }
        });
    },

    'alldatebusiness2':function (req,res) {
        // console.log(req.cookies);
        OrderModule.alldatebusiness2(req.body.JD_uid,req.body.endtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.endtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    'srdatebusiness2':function (req,res) {
        // console.log(req.cookies);
        OrderModule.srdatebusiness2(req.body.JD_uid,req.body.endtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.endtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'超时接单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'对方忙，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case'进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'收入',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户下单，已支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }
            }
        });
    },
    'zcdatebusiness2':function (req,res) {
        // console.log(req.cookies);
        OrderModule.zcdatebusiness2(req.body.JD_uid,req.body.endtime,function (err, data) {
            console.log(req.body.JD_uid,req.body.endtime);
            console.log(data);
            var arr1=[];
            if(err){
                console.log('数据库错误:'+err);
                res.send({error:1,accountManagement:'数据库错误'});
            }else{
                if(data.length){
                    for(var i=0;i<data.length;i++){
                        if(data[i].YH==req.body.JD_uid){
                            switch (data[i].ZT){
                                case'已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '待接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '进行中':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                                case '已评价':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'客户',
                                        ms:'订单支付',
                                        date:data[i].ZFDATA
                                    });
                                    break;
                            }
                        }
                        else if(data[i].PW == req.body.JD_uid){
                            switch (data[i].ZT){
                                case '已取消接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'客户取消订单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '超时接单':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'接单超时，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                                case '对方忙':
                                    arr1.push({
                                        dd:data[i].DD,
                                        lx:'支出',
                                        money:data[i].MONEY,
                                        jdtype:'陪玩',
                                        ms:'你拒绝了此单，退回金额',
                                        date:data[i].JDDATA
                                    });
                                    break;
                            }
                        }
                    }
                    res.send({error:0,data:arr1});
                }
                else{
                    res.send({error:1,accountManagement:'您暂任何交易'});
                }

            }
        });
    },





};

module.exports=json;


